package com.blog.quartzTest;

import com.blog.util.DateFormatUtil;
import org.assertj.core.util.DateUtil;
import org.quartz.*;

import java.util.Date;
import java.util.StringJoiner;

/**
 * @author cgx
 * @Date 2021/11/19 16:52
 */
public class helloQuartz2 implements Job {
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {

        JobDetail jobDetail = jobExecutionContext.getJobDetail();
        Trigger trigger = jobExecutionContext.getTrigger();
        StringJoiner stringJoiner = new StringJoiner("   ")
                .add("开始任务222")
                .add(DateFormatUtil.dataToStrLong(new Date()))
                .add(Thread.currentThread().getName())
                .add(jobExecutionContext.getTrigger().getKey().getName());

        System.err.println(stringJoiner);

        System.err.println(jobExecutionContext.getMergedJobDataMap().get("haha"));
    }
}
